package com.zjdiepu.www.rest.api.icbc;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.zjdiepu.www.base.BaseController;
import com.zjdiepu.www.base.core.ApiResponse;
import com.zjdiepu.www.base.core.PageVo;
import com.zjdiepu.www.base.enums.status.BusiStatus;
import com.zjdiepu.www.base.enums.status.DpStatus;
import com.zjdiepu.www.base.enums.type.CreditPeopleType;
import com.zjdiepu.www.base.enums.type.DataDicType;
import com.zjdiepu.www.base.enums.type.ResultFlagType;
import com.zjdiepu.www.base.enums.type.TypeData;
import com.zjdiepu.www.common.consts.SystemConsts;
import com.zjdiepu.www.common.util.CollectionInitUtil;
import com.zjdiepu.www.commpent.handler.TokenUserHelper;
import com.zjdiepu.www.commpent.mapper.yw.YwBusinessVoMapper;
import com.zjdiepu.www.ibiz.cache.ICachedDictionaryService;
import com.zjdiepu.www.ibiz.icbc.IYwOpenCardHzicbcService;
import com.zjdiepu.www.ibiz.icbc.IYwOpenCardHzicbcSubService;
import com.zjdiepu.www.ibiz.yw.IYwBusinessBuyerService;
import com.zjdiepu.www.ibiz.yw.IYwBusinessService;
import com.zjdiepu.www.model.base.dto.SysUser;
import com.zjdiepu.www.model.icbc.dto.YwOpenCardHzicbc;
import com.zjdiepu.www.model.icbc.dto.YwOpenCardHzicbcSub;
import com.zjdiepu.www.model.icbc.ext.YwOpenCardHzicbcExt;
import com.zjdiepu.www.model.icbc.vo.YwOpenCardHzicbcSubVo;
import com.zjdiepu.www.model.yw.dto.YwBusiness;
import com.zjdiepu.www.model.yw.dto.YwBusinessBuyer;
import com.zjdiepu.www.model.yw.request.YwBusinessQueryRequest;
import com.zjdiepu.www.response.BooleanResponse;
import com.zjdiepu.www.util.PinYinUtil;

@RestController
@RequestMapping(value= "YwOpenCardHZICBCController", produces="application/json;charset=UTF-8")
@Api(tags = {"杭州工行开卡"}, produces="application/json;charset=UTF-8")
public class YwOpenCardHZICBCController extends BaseController{

	@Resource
	private IYwBusinessService ywBusinessService;
	
	@Resource
    private TokenUserHelper tokenUserHelper;
	@Resource
    private YwBusinessVoMapper ywBusinessVoMapper;
    @Resource
    private ICachedDictionaryService cachedDictionaryService;
	@Resource
	private IYwOpenCardHzicbcService ywOpenCardHzicbcService;
	@Resource
	private IYwOpenCardHzicbcSubService ywOpenCardHzicbcSubService;
	@Resource
	private IYwBusinessBuyerService ywBusinessBuyerService;
	
	
	 @ApiOperation(value = "开卡申请列表",response = YwBusiness.class, httpMethod="POST")
	    @ApiImplicitParams({
	    	@ApiImplicitParam(name = SystemConsts.MOBILE_FLAG, defaultValue="ios", value = "请求机器标识", required = true, paramType = "header", dataType = "String"),
	    	@ApiImplicitParam(name = SystemConsts.HEADER_FOR_TOKEN, defaultValue="Ajesget8XF7zNMpt+MM8cr0wI8S+IO6a9giEKNouXWvOO3wWWyaKjSDTqRUtHlcNbjCg1JaPdjRX6dX/O1oGLgE=", value = "token", required = true, paramType = "header", dataType = "String")
	    })
	    @RequestMapping(value = "getYwOpenCardList", method = RequestMethod.POST)
	public ApiResponse getYwOpenCardList(@RequestBody YwBusinessQueryRequest ywBusinessQueryRequest){
		SysUser currentUser=tokenUserHelper.getUser();
		PageVo page = getPage(ywBusinessQueryRequest);
		ywBusinessQueryRequest.setBaseWhere();
		ywBusinessQueryRequest.setBankLoan(currentUser.getLoanBank());
		ywBusinessQueryRequest.setWhereSql(" AND B.OPEN_CARD_STATUS !=100  and B.OPEN_CARD_STATUS !=200 ");
		ywBusinessQueryRequest.setTypeData(TypeData.HZICBC.getCode());
		ywBusinessQueryRequest.setBusiStatusLess(BusiStatus.CHU_SHEN_DAN_CHU_SHEN_ZHONG.getCode());
		ywBusinessQueryRequest.setBusiStatusMore(BusiStatus.QIAN_SHU_HE_TONG_ZHONG.getCode());
        ywBusinessQueryRequest.setCodeUnits(currentUser.getCodeUnits());
        ywBusinessQueryRequest.setNeedLimit(true);
        int records = ywBusinessService.countMultiByExt(ywBusinessQueryRequest);
        page.setRecords(records);
        if (records > 0) {
            List<YwBusiness> ywBusinesss = ywBusinessService.selectMultiByExt(ywBusinessQueryRequest);
            ywBusinessVoMapper.mapper(ywBusinesss);
            YwOpenCardHzicbc ywOpenCardHzicbc=null;
            for (YwBusiness ywBusiness : ywBusinesss) {
            	ywOpenCardHzicbc=new YwOpenCardHzicbc();
            	ywOpenCardHzicbc.setBusiId(ywBusiness.getId());
            	ywOpenCardHzicbc.setDpStatus(DpStatus.NORMAL.getCode());
            	ywOpenCardHzicbc=ywOpenCardHzicbcService.selectRefined(ywOpenCardHzicbc);
            	if(ywOpenCardHzicbc!=null){
            		ywBusiness.setRepaymentDate(ywOpenCardHzicbc.getRepaymentDate());
            		ywBusiness.setBankStatementDate(ywOpenCardHzicbc.getBankStatementDate());
            		ywBusiness.setTimeApplyOpencard(ywOpenCardHzicbc.getOpencardSubmitTime());
            		ywBusiness.setOpenCardStatus(ywOpenCardHzicbc.getOpenCardStatus());
            		ywBusiness.setOpenCardStatusDisplay(cachedDictionaryService.getName(String.valueOf(ywOpenCardHzicbc.getOpenCardStatus()), DataDicType.OPEN_CARD_STATUS));
            	}
			}
            page.setRows(ywBusinesss);
        } else {
            page.setRows(CollectionInitUtil.emptyList());
        }
		return ApiResponse.success(page);
	}
	 @ApiOperation(value = "查询开卡申请详情信息",response = YwOpenCardHzicbc.class, httpMethod="POST")
	    @ApiImplicitParams({
	    	@ApiImplicitParam(name = SystemConsts.MOBILE_FLAG, defaultValue="ios", value = "请求机器标识", required = true, paramType = "header", dataType = "String"),
	    	@ApiImplicitParam(name = SystemConsts.HEADER_FOR_TOKEN, defaultValue="Ajesget8XF7zNMpt+MM8cr0wI8S+IO6a9giEKNouXWvOO3wWWyaKjSDTqRUtHlcNbjCg1JaPdjRX6dX/O1oGLgE=", value = "token", required = true, paramType = "header", dataType = "String")
	    })
	    @RequestMapping(value = "selectRefined", method = RequestMethod.POST)
	    public ApiResponse selectRefined(@RequestBody YwOpenCardHzicbcExt ywOpenCardHzicbcExt){
	    	
	    	YwOpenCardHzicbcSub ywOpenCardHzicbcSub=new YwOpenCardHzicbcSub();
	    	ywOpenCardHzicbcSub.setBusiId(ywOpenCardHzicbcExt.getBusiId());
	    	ywOpenCardHzicbcSub=ywOpenCardHzicbcSubService.selectRefined(ywOpenCardHzicbcSub);
	    	if(ywOpenCardHzicbcSub!=null){
	    		ywOpenCardHzicbcSub.setDrawmodeDisplay(cachedDictionaryService.getName(String.valueOf(ywOpenCardHzicbcSub.getDrawmode()), DataDicType.HZICBC_DRAW_MODE));
	    		ywOpenCardHzicbcSub.setAccgetmDisplay(cachedDictionaryService.getName(String.valueOf(ywOpenCardHzicbcSub.getAccgetm()), DataDicType.HZICBC_ACC_GETM));
	    		ywOpenCardHzicbcSub.setEmladdrfDisplay(cachedDictionaryService.getName(String.valueOf(ywOpenCardHzicbcSub.getEmladdrf()), DataDicType.HZICBC_EML_ADDRF));
	    		ywOpenCardHzicbcSub.setMachgfDisplay(cachedDictionaryService.getName(String.valueOf(ywOpenCardHzicbcSub.getMachgf()), DataDicType.HZICBC_MACHGF));
	    		ywOpenCardHzicbcSub.setMrtlstatDisplay(cachedDictionaryService.getName(String.valueOf(ywOpenCardHzicbcSub.getMrtlstat()), DataDicType.HZICBC_MRTL_STAT));
	    		ywOpenCardHzicbcSub.setEdulvlDisplay(cachedDictionaryService.getName(String.valueOf(ywOpenCardHzicbcSub.getEdulvl()), DataDicType.HZICBC_EDU_LVL));
	    		ywOpenCardHzicbcSub.setHomestatDisplay(cachedDictionaryService.getName(String.valueOf(ywOpenCardHzicbcSub.getHomestat()), DataDicType.HZICBC_HOME_STAT));
	    		ywOpenCardHzicbcSub.setModelcodeDisplay(cachedDictionaryService.getName(String.valueOf(ywOpenCardHzicbcSub.getModelcode()), DataDicType.HZICBC_MODEL_CODE));
	    		if(ywOpenCardHzicbcSub.getReltsex1()!=null){
	    			ywOpenCardHzicbcSub.setReltsex1Display(ywOpenCardHzicbcSub.getReltsex1().equals("1")?"男":"女");
	    		}
	    		if(ywOpenCardHzicbcSub.getReltsex2()!=null){
	    			ywOpenCardHzicbcSub.setReltsex2Display(ywOpenCardHzicbcSub.getReltsex2().equals("1")?"男":"女");
	    		}
	    		ywOpenCardHzicbcSub.setOccptnDisplay(cachedDictionaryService.getName(String.valueOf(ywOpenCardHzicbcSub.getOccptn()), DataDicType.JOB));
//	    		ywOpenCardHzicbcSub.setReltship1Display(cachedDictionaryService.getName(String.valueOf(ywOpenCardHzicbcSub.getReltship1()), DataDicType.CONTACT_RELATION));
//	    		ywOpenCardHzicbcSub.setReltship2Display(cachedDictionaryService.getName(String.valueOf(ywOpenCardHzicbcSub.getReltship2()), DataDicType.CONTACT_RELATION));
	    	}else{
	    		ywOpenCardHzicbcSub=new YwOpenCardHzicbcSub();
	    		ywOpenCardHzicbcSub.setBusiId(ywOpenCardHzicbcExt.getBusiId());
	    	}
	    	YwBusinessBuyer ywBusinessBuyer=new YwBusinessBuyer();
	    	ywBusinessBuyer.setBusiId(ywOpenCardHzicbcExt.getBusiId());
	    	ywBusinessBuyer.setCarManType(CreditPeopleType.ZHU_JIE_REN.getCode());
	    	ywBusinessBuyer.setDpStatus(DpStatus.NORMAL.getCode());
	    	ywBusinessBuyer=ywBusinessBuyerService.selectRefined(ywBusinessBuyer);
	    	if(ywBusinessBuyer!=null){
	    		ywOpenCardHzicbcSub.setUnitName(ywBusinessBuyer.getCompany());
	    		ywOpenCardHzicbcSub.setReltship1Display(cachedDictionaryService.getName(String.valueOf(ywBusinessBuyer.getContact1Relation()), DataDicType.CONTACT_RELATION));
	    		ywOpenCardHzicbcSub.setReltship2Display(cachedDictionaryService.getName(String.valueOf(ywBusinessBuyer.getContact2Relation()), DataDicType.CONTACT_RELATION));
	    		if(ywOpenCardHzicbcSub!=null && StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltship1())){
	    			ywOpenCardHzicbcSub.setReltship1(ywBusinessBuyer.getContact1Relation());
	    		}
	    		if(ywOpenCardHzicbcSub!=null && StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltship2())){
	    			ywOpenCardHzicbcSub.setReltship2(ywBusinessBuyer.getContact2Relation());
	    		}
	    		if(ywOpenCardHzicbcSub!=null && StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltname1())){
	    			ywOpenCardHzicbcSub.setReltname1(ywBusinessBuyer.getContact1());
	    		}
	    		if(ywOpenCardHzicbcSub!=null && StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltname2())){
	    			ywOpenCardHzicbcSub.setReltname2(ywBusinessBuyer.getContact2());
	    		}
	    		if(ywOpenCardHzicbcSub!=null && StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltmobl1())){
	    			ywOpenCardHzicbcSub.setReltmobl1(ywBusinessBuyer.getContact1Tel1());
	    		}
	    		if(ywOpenCardHzicbcSub!=null && StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltmobl2())){
	    			ywOpenCardHzicbcSub.setReltmobl2(ywBusinessBuyer.getContact2Tel1());
	    		}
	    	}
	    	YwBusiness ywBusiness=ywBusinessService.selectById(ywOpenCardHzicbcExt.getBusiId());
	    	if(ywBusiness!=null){
	    		ywOpenCardHzicbcSub.setCustcode(ywBusiness.getCustomerNo());
	    		ywOpenCardHzicbcSub.setChnsname(ywBusiness.getCustomerName());
	    		ywOpenCardHzicbcSub.setEngname(PinYinUtil.toPinYin(ywBusiness.getCustomerName(),true,20));
	    		ywOpenCardHzicbcSub.setCusId(ywBusiness.getCustomerId());
	    	}
	    	return ApiResponse.success(ywOpenCardHzicbcSub);
	    }
	 
	 @ApiOperation(value = "保存开卡申请",response = Integer.class, httpMethod="POST")
	    @ApiImplicitParams({
	    	@ApiImplicitParam(name = SystemConsts.MOBILE_FLAG, defaultValue="ios", value = "请求机器标识", required = true, paramType = "header", dataType = "String"),
	    	@ApiImplicitParam(name = SystemConsts.HEADER_FOR_TOKEN, defaultValue="Ajesget8XF7zNMpt+MM8cr0wI8S+IO6a9giEKNouXWvOO3wWWyaKjSDTqRUtHlcNbjCg1JaPdjRX6dX/O1oGLgE=", value = "token", required = true, paramType = "header", dataType = "String")
	    })
	    @RequestMapping(value = "saveYwOpenCard", method = RequestMethod.POST)
	 public ApiResponse saveYwOpenCard(@RequestBody YwOpenCardHzicbcSubVo ywOpenCardHzicbc){
		 SysUser currentUser=tokenUserHelper.getUser();
		 ywOpenCardHzicbc.setModifier(currentUser.getId()); //统一使用修改人和修改人名称来初始化
	     ywOpenCardHzicbc.setModifierName(currentUser.getName());
	     ywOpenCardHzicbc.setOpenCardStatus(10);
	     ywOpenCardHzicbcService.saveYwOpenCardHzicbc(ywOpenCardHzicbc, currentUser);
		 return ApiResponse.success(true);
	 }
	 
	 @ApiOperation(value = "修改开卡申请",response = Integer.class, httpMethod="POST")
	    @ApiImplicitParams({
	    	@ApiImplicitParam(name = SystemConsts.MOBILE_FLAG, defaultValue="ios", value = "请求机器标识", required = true, paramType = "header", dataType = "String"),
	    	@ApiImplicitParam(name = SystemConsts.HEADER_FOR_TOKEN, defaultValue="Ajesget8XF7zNMpt+MM8cr0wI8S+IO6a9giEKNouXWvOO3wWWyaKjSDTqRUtHlcNbjCg1JaPdjRX6dX/O1oGLgE=", value = "token", required = true, paramType = "header", dataType = "String")
	    })
	    @RequestMapping(value = "updateYwOpenCard", method = RequestMethod.POST)
	 public ApiResponse updateYwOpenCard(@RequestBody YwOpenCardHzicbcSubVo ywOpenCardHzicbc){
		 SysUser currentUser=tokenUserHelper.getUser();
		 ywOpenCardHzicbc.setModifier(currentUser.getId()); //统一使用修改人和修改人名称来初始化
	     ywOpenCardHzicbc.setModifierName(currentUser.getName());
	     ywOpenCardHzicbcService.updateOpenCardInfo(ywOpenCardHzicbc);
	     return ApiResponse.success(true);
	 }
	 
	 @ApiOperation(value = "提交开卡申请",response = Integer.class, httpMethod="POST")
	    @ApiImplicitParams({
	    	@ApiImplicitParam(name = SystemConsts.MOBILE_FLAG, defaultValue="ios", value = "请求机器标识", required = true, paramType = "header", dataType = "String"),
	    	@ApiImplicitParam(name = SystemConsts.HEADER_FOR_TOKEN, defaultValue="Ajesget8XF7zNMpt+MM8cr0wI8S+IO6a9giEKNouXWvOO3wWWyaKjSDTqRUtHlcNbjCg1JaPdjRX6dX/O1oGLgE=", value = "token", required = true, paramType = "header", dataType = "String")
	    })
	    @RequestMapping(value = "commitYwOpenCard", method = RequestMethod.POST)
	 public ApiResponse commitYwOpenCard(@RequestBody YwOpenCardHzicbcSub ywOpenCardHzicbc){
		 SysUser currentUser=tokenUserHelper.getUser();
		 ywOpenCardHzicbc.setModifier(currentUser.getId()); //统一使用修改人和修改人名称来初始化
	     ywOpenCardHzicbc.setModifierName(currentUser.getName());
	     YwOpenCardHzicbcSub ywOpenCardHzicbcSub=new YwOpenCardHzicbcSub();
	     ywOpenCardHzicbcSub.setBusiId(ywOpenCardHzicbc.getBusiId());
	     ywOpenCardHzicbcSub.setDpStatus(DpStatus.NORMAL.getCode());
	     ywOpenCardHzicbcSub=ywOpenCardHzicbcSubService.selectRefined(ywOpenCardHzicbcSub);
	     
	     if(ywOpenCardHzicbcSub==null){
	    		return ApiResponse.fail(ResultFlagType.MISSING);
	    	}
	    	//检查空字段
	    	Map<String,String> map=checkEmpty(ywOpenCardHzicbcSub);
	    	if(map!=null && map.size()>0){
	    		return ApiResponse.fail(300000,map.get("emptyKey"));
	    	}
	     
//    	 if(!ywOpenCardHzicbcSub.complet()) {
//    		 return ApiResponse.fail(ResultFlagType.YOU_YAN_ZHENG_WEI_TONG_GUO); 
//    	 }
    	 BooleanResponse flag=ywOpenCardHzicbcService.commitYwOpenCardHzicbc(ywOpenCardHzicbc, currentUser);
    	 if(flag !=null&&flag.getResult()==true){
    		 return ApiResponse.success(true);
    	 }
	     return ApiResponse.fail(ResultFlagType.MISSING);
	 }
	 private Map<String,String> checkEmpty(YwOpenCardHzicbcSub ywOpenCardHzicbcSub) {
	    	Map<String,String> map = new HashMap<String,String>();
	    	if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getAuthref())){
	    		map.put("emptyKey", "发证单位不能为空");
	    		
	    	}
	    	if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getChnsname())){
	    		map.put("emptyKey", "客户姓名不能为空");
	    		
	    	}
	    	if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getBusiId())){
	    		map.put("emptyKey", "业务id不能为空");
	    		
	    	}
	    	if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCusId())){
	    		map.put("emptyKey", "客户id不能为空");
	    		
	    	}
	    	if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCustcode())){
	    		map.put("emptyKey", "身份证号不能为空");
	    		
	    	}
	    	if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCustsort())){
	    		map.put("emptyKey", "证件类型不能为空");
	    		
	    	}
	    	if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getMrtlstat())){
	    		map.put("emptyKey", "婚姻情况不能为空");
	    		
	    	}
	    	if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getEdulvl())){
	    		map.put("emptyKey", "教育程度不能为空");
	    		
	    	}
	    	if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getMvblno())){
	    		map.put("emptyKey", "手机号码不能为空");
	    		
	    	}
	    	if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getDrawmode())){
	    		map.put("emptyKey", "卡片领取方式不能为空");
	    		
	    	}
	    	if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getAccgetm())){
	    		map.put("emptyKey", "对帐单寄送方式不能为空");
	    		
	    	}
	    	if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getMamobile())){
	    		map.put("emptyKey", "主卡发送移动电话不能为空");
	    		
	    	}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getSmsphone())){
				map.put("emptyKey", "发送短信帐单手机号码不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getEmladdrf())){
				map.put("emptyKey", "开通email对账单不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getStmtemail())&& ywOpenCardHzicbcSub.getEmladdrf().equals("1")){
				map.put("emptyKey", "对帐单EMAIL不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getMachgf())){
				map.put("emptyKey", "主卡开通余额变动提醒不能为空");
				
			}
			if((StringUtils.isEmpty(ywOpenCardHzicbcSub.getMachgmobile())&& ywOpenCardHzicbcSub.getMachgf().equals("1"))){
				map.put("emptyKey", "主卡余额提醒发送手机号码不能为空");
				
			}
			if(null==ywOpenCardHzicbcSub.getBirthdate()){
				map.put("emptyKey", "出生日期不能为空");
				
			}
			if(null==ywOpenCardHzicbcSub.getStatdate()){
				map.put("emptyKey", "证件有效期不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getEngname())){
				map.put("emptyKey", "英文名不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getHprovince())){
				map.put("emptyKey", "住宅地址省份不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getHcity())){
				map.put("emptyKey", "住宅地址市不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getHcounty())){
				map.put("emptyKey", "住宅地址县不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getHaddress())){
				map.put("emptyKey", "住宅地址不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getHomestat())){
				map.put("emptyKey", "住宅状况不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getHomezip())){
				map.put("emptyKey", "住宅邮编不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getIndate())){
				map.put("emptyKey", "何时入住现址不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCommprov())){
				map.put("emptyKey", "通讯地址省份不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCommcity())){
				map.put("emptyKey", "通讯地址市不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCommcounty())){
				map.put("emptyKey", "通讯地址县不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCommaddr())){
				map.put("emptyKey", "通讯地址不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCommazip())){
				map.put("emptyKey", "通讯地址邮编不能为空");
				
			}
			if(null==ywOpenCardHzicbcSub.getJoindate()){
				map.put("emptyKey", "进入单位时间不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getModelcode())){
				map.put("emptyKey", "单位性质不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltsex1())){
				map.put("emptyKey", "紧急联系人1性别不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCprovince())){
				map.put("emptyKey", "单位地址省份不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCcity())){
				map.put("emptyKey", "单位地址市不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCcounty())){
				map.put("emptyKey", "单位地址县不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCaddress())){
				map.put("emptyKey", "单位地址不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCorpzip())){
				map.put("emptyKey", "单位邮编不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltname1())){
				map.put("emptyKey", "联系人一姓名不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltship1())){
				map.put("emptyKey", "联系人一与主卡申请关系不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltmobl1())){
				map.put("emptyKey", "联系人一手机不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltname2())){
				map.put("emptyKey", "联系人二姓名不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltsex2())){
				map.put("emptyKey", "联系人二性别不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltship2())){
				map.put("emptyKey", "联系人二与主卡申请不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getReltmobl2())){
				map.put("emptyKey", "联系人二手机不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getOccptn())){
				map.put("emptyKey", "职业不能为空");
				
			}
			if(StringUtils.isEmpty(ywOpenCardHzicbcSub.getCcol1())){
				map.put("emptyKey", "单位名称不能为空");
				
			}
			if( null==ywOpenCardHzicbcSub.getYearincome()){
				map.put("emptyKey", "年收入不能为空");
				
		    }
			return map;
	    	
			
		}
}
